<script setup lang="ts">
import { Layout, ConfigProvider } from 'ant-design-vue';
import { useRoute, useRouter } from 'vue-router';
import zhCN from 'ant-design-vue/es/locale/zh_CN';

const { Header, Content, Footer } = Layout;
const route = useRoute();
const router = useRouter();

// 处理导航
const handleNav = (path: string) => {
  router.push({ path });
};
</script>

<template>
  <ConfigProvider :locale="zhCN">
    <Layout class="app-layout">
      <Header class="app-header">
        <div class="logo">AI知识库助手</div>
        <div class="app-nav" style="color: #fff;">
          <div 
            class="nav-item" 
            :class="{ active: route.path === '/chat' }" 
            @click="handleNav('/chat')"
          >
            聊天
          </div>
          <div 
            class="nav-item" 
            :class="{ active: route.path === '/knowledge' }" 
            @click="handleNav('/knowledge')"
          >
            知识库
          </div>
          <div 
            class="nav-item" 
            :class="{ active: route.path === '/debug' }" 
            @click="handleNav('/debug')"
          >
            调试
          </div>
        </div>
      </Header>
      
      <Content class="app-content">
        <router-view />
      </Content>
      
      <Footer class="app-footer">
        <p>极佑AI知识库助手 &copy; {{ new Date().getFullYear() }}</p>
        <p>
          <!-- <small>基于腾讯云大模型知识引擎</small> -->
        </p>
      </Footer>
    </Layout>
  </ConfigProvider>
</template>

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#app {
    width: 100%;
  height: 100%;
  min-width: 1280px;
}

.app-layout {
  min-height: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  background: #fff;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  color: #1890ff;
  margin-right: 48px;
}

.app-nav {
  display: flex;
}

.nav-item {
  padding: 0 20px;
  line-height: 64px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s;
}

.nav-item:hover {
  color: #1890ff;
}

.nav-item.active {
  color: #1890ff;
  border-bottom: 2px solid #1890ff;
}

.app-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 134px);
}

.app-footer {
  text-align: center;
  padding: 12px;
  background: #f0f2f5;
  color: rgba(0, 0, 0, 0.65);
}

.app-footer p {
  margin: 4px 0;
}
</style>
